package com.ffapp.rainmonitorcustom.bean;

import android.text.TextUtils;

import com.amap.api.maps2d.model.LatLng;
import com.ffapp.rainmonitorcustom.R;
import com.ffapp.rainmonitorcustom.basis.Constants;

import my.FileUtils;
import my.LogUtil;
import my.TimeUtils;

public class DeviceListData extends BasisBean {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * addvcd : null
	 * addvnm1 : null
	 * addvnm2 : null
	 * approvedEcoFlow : 0
	 * cameratype : null
	 * commode : null
	 * dsfl : null
	 * dvraddr : null
	 * dvrcode : null
	 * faddvcd : null
	 * hjCs : 171.802
	 * hjFsgs : 6
	 * hjGox1 : 8
	 * hjGox2 : null
	 * hjGox3 : null
	 * hjGox4 : null
	 * hjGox5 : null
	 * hjGs : 164.43
	 * hjGsox1 : 164.43
	 * hjGsox2 : null
	 * hjGsox3 : null
	 * hjGsox4 : null
	 * hjGsox5 : null
	 * hjHl : 5
	 * hjMs : 1.372
	 * hjMsox1 : 1.372
	 * hjMsox2 : null
	 * hjMsox3 : null
	 * hjMsox4 : null
	 * hjMsox5 : null
	 * id : null
	 * iscamera : null
	 * lastonline : null
	 * lgtd : null
	 * lttd : null
	 * moditime : null
	 * q : null
	 * qa : null
	 * signalinten : null
	 * stcd : null
	 * stlc : null
	 * stnm : null
	 * sttp : null
	 * tm : 1542350501000
	 * va : null
	 * videochannel : null
	 * vj : null
	 * voltage : null
	 * z : null
	 */
	

	private String addvcd;
	private String addvnm1;
	private String addvnm2;
	private double approvedEcoFlow;
	private String cameratype;
	private String commode;
	private int dsfl;
	private String dvraddr;
	private String dvrcode;
	private String faddvcd;
	private double hjCs;
	private double hjFsgs;
	private double hjGox1;
	private String hjGox2;
	private String hjGox3;
	private String hjGox4;
	private String hjGox5;
	private double hjGs;
	private double hjGsox1;
	private String hjGsox2;
	private String hjGsox3;
	private String hjGsox4;
	private String hjGsox5;
	private double hjHl;
	private double hjMs;
	private double hjMsox1;
	private String hjMsox2;
	private String hjMsox3;
	private String hjMsox4;
	private String hjMsox5;
	private String id;
	private String iscamera;
	private String lastonline;
	private String lgtd;
	private String lttd;
	private String moditime;
	private String q;
	private String qa;
	private String signalinten;
	private String stcd;//设备编码
	private String stlc;
	private String stnm;
	private String sttp;
	private long tm;
	private String va;
	private String videochannel;
	private String vj;
	private String voltage;
	private String z;
	private String capacity;
	private String workerphone;
	private String workername;
	private String workermobile;
	private int ApprovedEcoFlowModel;




	private String imgurl;
	private String name;
	private String unit;
	private String flag;
	/**
	 * ai : null
	 * c : null
	 * cameratype : 0
	 * chla : null
	 * cond : null
	 * doxy : null
	 * ed : null
	 * ej : null
	 * fl : null
	 * gtp : null
	 * h : null
	 * hassolved : 1
	 * id : null
	 * iscamera : 0
	 * k1 : 0
	 * k2 : 0
	 * lastonline : null
	 * lgtd : 118.144552
	 * lttd : 24.534832
	 * m10 : null
	 * m100 : null
	 * m20 : null
	 * m30 : null
	 * m40 : null
	 * m50 : null
	 * m60 : null
	 * m80 : null
	 * maxpj : null
	 * moditime : 1541487580000
	 * mst : null
	 * nh4n : null
	 * pJ : null
	 * ph : null
	 * pn05 : null
	 * q : null
	 * qa : null
	 * signalinten : null
	 * sttp : 2
	 * td11 : null
	 * td12 : null
	 * td13 : null
	 * td14 : null
	 * td15 : null
	 * td16 : null
	 * td17 : null
	 * td18 : null
	 * td19 : null
	 * td20 : null
	 * td21 : null
	 * td22 : null
	 * td23 : null
	 * td24 : null
	 * tn : null
	 * tp : null
	 * turb : null
	 * uc : null
	 * ue : null
	 * us : null
	 * va : null
	 * videochannel : null
	 * vj : null
	 * voltage : 12.12
	 * z : null
	 * zb : null
	 * zu : null
	 */

	private String ai;
	private String c;
	private String chla;
	private String cond;
	private String doxy;
	private String ed;
	private String ej;
	private String fl;
	private String gtp;
	private String h;
	private int hassolved;
	private int k1;
	private int k2;
	private String m10;
	private String m100;
	private String m20;
	private String m30;
	private String m40;
	private String m50;
	private String m60;
	private String m80;
	private String maxpj;
	private String mst;
	private String nh4n;
	private String pJ;
	private String ph;
	private String pn05;
	private String td11;
	private String td12;
	private String td13;
	private String td14;
	private String td15;
	private String td16;
	private String td17;
	private String td18;
	private String td19;
	private String td20;
	private String td21;
	private String td22;
	private String td23;
	private String td24;
	private String tn;
	private String tp;
	private String turb;
	private String uc;
	private String ue;
	private String us;
	private String zb;
	private String zu;

	public String getAddvcd() {
		return addvcd;
	}

	public void setAddvcd(String addvcd) {
		this.addvcd = addvcd;
	}

	public String getAddvnm1() {
		return addvnm1;
	}

	public void setAddvnm1(String addvnm1) {
		this.addvnm1 = addvnm1;
	}

	public String getAddvnm2() {
		return addvnm2;
	}

	public void setAddvnm2(String addvnm2) {
		this.addvnm2 = addvnm2;
	}

	public double getApprovedEcoFlow() {
		return approvedEcoFlow;
	}

	public void setApprovedEcoFlow(double approvedEcoFlow) {
		this.approvedEcoFlow = approvedEcoFlow;
	}

	public String getCameratype() {
		return cameratype;
	}

	public void setCameratype(String cameratype) {
		this.cameratype = cameratype;
	}

	public String getCommode() {
		return commode;
	}

	public void setCommode(String commode) {
		this.commode = commode;
	}

	public int getDsfl() {
		return dsfl;
	}

	public int getStatusImgRes(){
		switch (dsfl){
			case  0://设备离线
			case 2://设备休眠
			case 3://设备升级中
				return R.drawable.base_circle_grey;
			case 1://设备在线
				return R.drawable.base_circle_green;
		}
		return  R.drawable.base_circle_grey;
	}
	public void setDsfl(int dsfl) {
		this.dsfl = dsfl;
	}

	public String getDvraddr() {
		return dvraddr;
	}

	public void setDvraddr(String dvraddr) {
		this.dvraddr = dvraddr;
	}

	public String getDvrcode() {
		return dvrcode;
	}

	public void setDvrcode(String dvrcode) {
		this.dvrcode = dvrcode;
	}

	public String getFaddvcd() {
		return faddvcd;
	}

	public void setFaddvcd(String faddvcd) {
		this.faddvcd = faddvcd;
	}

	public double getHjCs() {
		return hjCs;
	}

	public void setHjCs(double hjCs) {
		this.hjCs = hjCs;
	}

	public double getHjFsgs() {
		return hjFsgs;
	}

	public void setHjFsgs(double hjFsgs) {
		this.hjFsgs = hjFsgs;
	}

	public double getHjGox1() {
		return hjGox1;
	}

	public void setHjGox1(double hjGox1) {
		this.hjGox1 = hjGox1;
	}

	public String getHjGox2() {
		return hjGox2;
	}

	public void setHjGox2(String hjGox2) {
		this.hjGox2 = hjGox2;
	}

	public String getHjGox3() {
		return hjGox3;
	}

	public void setHjGox3(String hjGox3) {
		this.hjGox3 = hjGox3;
	}

	public String getHjGox4() {
		return hjGox4;
	}

	public void setHjGox4(String hjGox4) {
		this.hjGox4 = hjGox4;
	}

	public String getHjGox5() {
		return hjGox5;
	}

	public void setHjGox5(String hjGox5) {
		this.hjGox5 = hjGox5;
	}

	public double getHjGs() {
		return hjGs;
	}

	public void setHjGs(double hjGs) {
		this.hjGs = hjGs;
	}

	public double getHjGsox1() {
		return hjGsox1;
	}

	public void setHjGsox1(double hjGsox1) {
		this.hjGsox1 = hjGsox1;
	}

	public String getHjGsox2() {
		return hjGsox2;
	}

	public void setHjGsox2(String hjGsox2) {
		this.hjGsox2 = hjGsox2;
	}

	public String getHjGsox3() {
		return hjGsox3;
	}

	public void setHjGsox3(String hjGsox3) {
		this.hjGsox3 = hjGsox3;
	}

	public String getHjGsox4() {
		return hjGsox4;
	}

	public void setHjGsox4(String hjGsox4) {
		this.hjGsox4 = hjGsox4;
	}

	public String getHjGsox5() {
		return hjGsox5;
	}

	public void setHjGsox5(String hjGsox5) {
		this.hjGsox5 = hjGsox5;
	}

	public double getHjHl() {
		return hjHl;
	}

	public void setHjHl(double hjHl) {
		this.hjHl = hjHl;
	}

	public double getHjMs() {
		return hjMs;
	}

	public void setHjMs(double hjMs) {
		this.hjMs = hjMs;
	}

	public double getHjMsox1() {
		return hjMsox1;
	}

	public void setHjMsox1(double hjMsox1) {
		this.hjMsox1 = hjMsox1;
	}

	public String getHjMsox2() {
		return hjMsox2;
	}

	public void setHjMsox2(String hjMsox2) {
		this.hjMsox2 = hjMsox2;
	}

	public String getHjMsox3() {
		return hjMsox3;
	}

	public void setHjMsox3(String hjMsox3) {
		this.hjMsox3 = hjMsox3;
	}

	public String getHjMsox4() {
		return hjMsox4;
	}

	public void setHjMsox4(String hjMsox4) {
		this.hjMsox4 = hjMsox4;
	}

	public String getHjMsox5() {
		return hjMsox5;
	}

	public void setHjMsox5(String hjMsox5) {
		this.hjMsox5 = hjMsox5;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getIscamera() {
		return iscamera;
	}

	public void setIscamera(String iscamera) {
		this.iscamera = iscamera;
	}

	public String getLastonline() {
		return lastonline;
	}
	public String getLastonlineStr() {
		if(TextUtils.isEmpty(lastonline))return "";
		long time = Long.valueOf(lastonline);

		return TimeUtils.getTimeLongToStrByFormat(time,"yyyy年MM月dd日");
	}
	public String getModiTimeStr() {
		if(TextUtils.isEmpty(moditime))return "";
		long time = Long.valueOf(moditime);

		return TimeUtils.getTimeLongToStrByFormat(time,"yyyy-MM-dd HH:mm:ss");
	}

	public void setLastonline(String lastonline) {
		this.lastonline = lastonline;
	}

	public String getLgtd() {
		return lgtd;
	}

	public void setLgtd(String lgtd) {
		this.lgtd = lgtd;
	}

	public String getLttd() {
		return lttd;
	}

	public void setLttd(String lttd) {
		this.lttd = lttd;
	}

	public String getModitime() {
		return moditime;
	}

	public void setModitime(String moditime) {
		this.moditime = moditime;
	}

	public String getQ() {
		return q;
	}

	public void setQ(String q) {
		this.q = q;
	}

	public String getQa() {
		return qa;
	}

	public void setQa(String qa) {
		this.qa = qa;
	}

	public String getSignalinten() {
		return signalinten;
	}

	public void setSignalinten(String signalinten) {
		this.signalinten = signalinten;
	}

	public String getStcd() {//设备编码
		return stcd;
	}

	public void setStcd(String stcd) {
		this.stcd = stcd;
	}

	public String getStlc() {
		if(TextUtils.isEmpty(stlc))return "-";
		return stlc;
	}

	public void setStlc(String stlc) {
		this.stlc = stlc;
	}

	public String getStnm() {
		if(TextUtils.isEmpty(stnm))return "-";
		return stnm;
	}

	public void setStnm(String stnm) {
		this.stnm = stnm;
	}

	public String getSttp() {
		return sttp;
	}

	public void setSttp(String sttp) {
		this.sttp = sttp;
	}

	public long getTm() {
		return tm;
	}
	public String getTm_Str() {
		return TimeUtils.getTimeLongToStrByFormat(tm,"yyyy-MM-dd HH:mm:ss");
	}

	public void setTm(long tm) {
		this.tm = tm;
	}

	public String getVa() {
		return va;
	}

	public void setVa(String va) {
		this.va = va;
	}

	public String getVideochannel() {
		return videochannel;
	}

	public void setVideochannel(String videochannel) {
		this.videochannel = videochannel;
	}

	public String getVj() {
		return vj;
	}

	public void setVj(String vj) {
		this.vj = vj;
	}

	public String getVoltage() {
		if(TextUtils.isEmpty(voltage))return "0";
		return voltage;
	}

	public void setVoltage(String voltage) {
		this.voltage = voltage;
	}

	public String getZ() {
		if(TextUtils.isEmpty(z))return "0";
		return z;
	}

	public void setZ(String z) {
		this.z = z;
	}

	public int getMapMarkerResid(){
		switch (dsfl){
//			case 0:return R.drawable.map_icon_location_grey;
//			case 1:return R.drawable.map_icon_location_blue;
//			case 2:return R.drawable.map_icon_location_red;
//			case 3:return R.drawable.map_icon_location_blue;
			default:return R.drawable.map_icon_location_grey;
		}
	}

	public LatLng getLatlng() {
		if(TextUtils.isEmpty(lttd)){
			return  new LatLng(0,0);
		}
		LatLng latLng = new LatLng(Double.valueOf(lttd),Double.valueOf(lgtd));
		return latLng;
	}




	public static final String FILE_CACHE = Constants.DIR_FILECACHE
			+ "homelistdata.data";
	private static DeviceListData sHomeListData;

	public static DeviceListData getInstance() {
		if (sHomeListData == null)
			sHomeListData = getFromCache();
		return sHomeListData;
	}

	public static DeviceListData getFromCache() {
		DeviceListData data;
		data = (DeviceListData) FileUtils.readObject(FILE_CACHE);
		if (data != null) {
			sHomeListData = data;
		}
		LogUtil.i("login---->getFromCache---" + (data == null));
		return data;
	}

	public void save() {
		sHomeListData = this;
		FileUtils.cacheObject(FILE_CACHE, this);
		// FileSaveHandler.saveString(FILE_CACHE, this);
		LogUtil.i("login---->save---" + FILE_CACHE);
	}

	private static void delete() {
		FileUtils.cacheObject(FILE_CACHE, null);
		// FileSaveHandler.removeString(FILE_CACHE);
	}

	public String getCapacity() {
		return capacity;
	}

	public void setCapacity(String capacity) {
		this.capacity = capacity;
	}

	public int getApprovedEcoFlowModel() {
		return ApprovedEcoFlowModel;
	}

	public String getApprovedEcoFlowModel_Str(){
		switch (ApprovedEcoFlowModel){
			case 1:
				return "沟渠式";
			case 2:
				return "虹式";
			case 3:
				return "自定义";
		}
		return "自定义";
	}

	public void setApprovedEcoFlowModel(int approvedEcoFlowModel) {
		ApprovedEcoFlowModel = approvedEcoFlowModel;
	}

	public String getWorkerphone() {
		return workerphone;
	}

	public void setWorkerphone(String workerphone) {
		this.workerphone = workerphone;
	}

	public String getWorkername() {
		return workername;
	}

	public void setWorkername(String workername) {
		this.workername = workername;
	}

	public String getWorkermobile() {
		return workermobile;
	}

	public void setWorkermobile(String workermobile) {
		this.workermobile = workermobile;
	}

	public String getVideoUrl(int params){
		LoginBean loginBean = LoginBean.getInstance();
		if(loginBean == null)return "";
		String url = String.format("rtmp://%s:%s/dvrlive/%s_%s.live",loginBean.getDvrVideoHost(),loginBean.getDvrVideoPort(),getStcd(),params+"");
//		String url = String.format("rtmp://%s:%s/dvrlive/%s_%s.live",loginBean.getDvrVideoHost(),loginBean.getDvrVideoPort(),getStcd(),params+"");

		return url;
	}

	public String getAi() {
		return ai;
	}

	public void setAi(String ai) {
		this.ai = ai;
	}

	public String getC() {
		return c;
	}

	public void setC(String c) {
		this.c = c;
	}


	public String getChla() {
		return chla;
	}

	public void setChla(String chla) {
		this.chla = chla;
	}

	public String getCond() {
		if(TextUtils.isEmpty(cond))return "0";
		return cond;
	}

	public void setCond(String cond) {
		this.cond = cond;
	}

	public String getDoxy() {
		if(TextUtils.isEmpty(doxy))return "0";
		return doxy;
	}

	public void setDoxy(String doxy) {
		this.doxy = doxy;
	}

	public String getEd() {
		return ed;
	}

	public void setEd(String ed) {
		this.ed = ed;
	}

	public String getEj() {
		return ej;
	}

	public void setEj(String ej) {
		this.ej = ej;
	}

	public String getFl() {
		if(TextUtils.isEmpty(fl))return "0";
		return fl;
	}

	public void setFl(String fl) {
		this.fl = fl;
	}

	public String getGtp() {
		return gtp;
	}

	public void setGtp(String gtp) {
		this.gtp = gtp;
	}

	public String getH() {
		if(TextUtils.isEmpty(h))return "0";
		return h;
	}

	public void setH(String h) {
		this.h = h;
	}

	public int getHassolved() {
		return hassolved;
	}

	public void setHassolved(int hassolved) {
		this.hassolved = hassolved;
	}

	public int getK1() {
		return k1;
	}

	public boolean getK1_BOOLEAN(){
		return  k1 == 1;
	}
	public boolean getK2_BOOLEAN(){
		return  k2 == 1;
	}

	public void setK1(int k1) {
		this.k1 = k1;
	}

	public int getK2() {
		return k2;
	}

	public void setK2(int k2) {
		this.k2 = k2;
	}

	public String getM10() {
		return m10;
	}

	public void setM10(String m10) {
		this.m10 = m10;
	}

	public String getM100() {
		return m100;
	}

	public void setM100(String m100) {
		this.m100 = m100;
	}

	public String getM20() {
		return m20;
	}

	public void setM20(String m20) {
		this.m20 = m20;
	}

	public String getM30() {
		return m30;
	}

	public void setM30(String m30) {
		this.m30 = m30;
	}

	public String getM40() {
		return m40;
	}

	public void setM40(String m40) {
		this.m40 = m40;
	}

	public String getM50() {
		return m50;
	}

	public void setM50(String m50) {
		this.m50 = m50;
	}

	public String getM60() {
		return m60;
	}

	public void setM60(String m60) {
		this.m60 = m60;
	}

	public String getM80() {
		return m80;
	}

	public void setM80(String m80) {
		this.m80 = m80;
	}

	public String getMaxpj() {
		return maxpj;
	}

	public void setMaxpj(String maxpj) {
		this.maxpj = maxpj;
	}

	public String getMst() {
		return mst;
	}

	public void setMst(String mst) {
		this.mst = mst;
	}

	public String getNh4n() {
		return nh4n;
	}

	public void setNh4n(String nh4n) {
		this.nh4n = nh4n;
	}

	public String getPJ() {
		return pJ;
	}

	public void setPJ(String pJ) {
		this.pJ = pJ;
	}

	public String getPh() {
		if(TextUtils.isEmpty(ph))return "";
		return ph;
	}

	public void setPh(String ph) {
		this.ph = ph;
	}

	public String getPn05() {
		return pn05;
	}

	public void setPn05(String pn05) {
		this.pn05 = pn05;
	}



	public String getTd11() {
		return td11;
	}

	public void setTd11(String td11) {
		this.td11 = td11;
	}

	public String getTd12() {
		return td12;
	}

	public void setTd12(String td12) {
		this.td12 = td12;
	}

	public String getTd13() {
		return td13;
	}

	public void setTd13(String td13) {
		this.td13 = td13;
	}

	public String getTd14() {
		return td14;
	}

	public void setTd14(String td14) {
		this.td14 = td14;
	}

	public String getTd15() {
		return td15;
	}

	public void setTd15(String td15) {
		this.td15 = td15;
	}

	public String getTd16() {
		return td16;
	}

	public void setTd16(String td16) {
		this.td16 = td16;
	}

	public String getTd17() {
		return td17;
	}

	public void setTd17(String td17) {
		this.td17 = td17;
	}

	public String getTd18() {
		return td18;
	}

	public void setTd18(String td18) {
		this.td18 = td18;
	}

	public String getTd19() {
		return td19;
	}

	public void setTd19(String td19) {
		this.td19 = td19;
	}

	public String getTd20() {
		return td20;
	}

	public void setTd20(String td20) {
		this.td20 = td20;
	}

	public String getTd21() {
		return td21;
	}

	public void setTd21(String td21) {
		this.td21 = td21;
	}

	public String getTd22() {
		return td22;
	}

	public void setTd22(String td22) {
		this.td22 = td22;
	}

	public String getTd23() {
		return td23;
	}

	public void setTd23(String td23) {
		this.td23 = td23;
	}

	public String getTd24() {
		return td24;
	}

	public void setTd24(String td24) {
		this.td24 = td24;
	}

	public String getTn() {
		return tn;
	}

	public void setTn(String tn) {
		this.tn = tn;
	}

	public String getTp() {
		return tp;
	}

	public void setTp(String tp) {
		this.tp = tp;
	}

	public String getTurb() {
		if(TextUtils.isEmpty(turb))return "0";
		return turb;
	}

	public void setTurb(String turb) {
		this.turb = turb;
	}

	public String getUc() {
		return uc;
	}

	public void setUc(String uc) {
		this.uc = uc;
	}

	public String getUe() {
		return ue;
	}

	public void setUe(String ue) {
		this.ue = ue;
	}

	public String getUs() {
		return us;
	}

	public void setUs(String us) {
		this.us = us;
	}

	public String getZb() {
		return zb;
	}

	public void setZb(String zb) {
		this.zb = zb;
	}

	public String getZu() {
		return zu;
	}

	public void setZu(String zu) {
		this.zu = zu;
	}

	public String getValueByName(String name){
		switch (name){
			case "水位":
				return getZ()+"m";
			case "绝对水位":
				return  getH()+"m";
			case "气压":
				return  getFl()+"KPa";
			case "浊度":
				return  getTurb()+"NTU";
			case "溶解氧":
				return getDoxy()+"mg/L";
			case "电导率":
				return  getCond()+"us/cm";
			case "pH":
				return getPh();

		}
		return getZ()+"m";
	}


	public  BaseListDataListBean getListInfo(){
		BaseListDataListBean listBean = new BaseListDataListBean();

		listBean.getList().add(new BaseListData(getZ()+"m","水位"));
		listBean.getList().add(new BaseListData(getH()+"m","绝对水位"));
		listBean.getList().add(new BaseListData(getFl()+"KPa","气压"));
		listBean.getList().add(new BaseListData(getTurb()+"NTU","浊度"));
		listBean.getList().add(new BaseListData(getDoxy()+"mg/L","溶解氧"));
		listBean.getList().add(new BaseListData(getCond()+"us/cm","电导率"));
		listBean.getList().add(new BaseListData( getPh(),"pH"));
		return listBean;
	}



	public String getImgurl() {
		return imgurl;
	}

	public void setImgurl(String imgurl) {
		this.imgurl = imgurl;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}


}
